# -*- coding:utf-8 -*-
# @FileName  :per_report.py
# @Time      :2020/11/17 14:38
# @Author    :Zhoujirong
# @Desc      :

from common.http_request import Request
from biz.support.urls import ServerUrl

class EntReportRequest:
    @classmethod
    def ent_info(cls,enterpriseName,signCode,uniformSocialCredCode,orgInstCode,assocbsnssData,
                 note,queryFormat,resultType,qryReason,queryControlWarningType,serialNumber,cookie):
        data = {
            'enterpriseName': enterpriseName,
            'signCode': signCode,
            'uniformSocialCredCode': uniformSocialCredCode,
            'orgInstCode': orgInstCode,
            'assocbsnssData': assocbsnssData,
            'note': note,
            'queryFormat': queryFormat,
            'resultType': resultType,
            'qryReason': qryReason,
            'queryControlWarningType': queryControlWarningType,
            'serialNumber': serialNumber
        }
        req = Request(ServerUrl.ent_info_url, data=data,headers=cookie)
        return req.post()

    @classmethod
    def ent_archive_create(cls,archiveType,Num,enterpriseName,signCode,orgInstCode,
                           uniformSocialCredCode,startDate,expireDate,note,
                           paperFileId,fileDescribe,cookie):

        data = {
            'archiveType': archiveType,
            'Num': Num,
            'enterpriseName': enterpriseName,
            'signCode': signCode,
            'orgInstCode': orgInstCode,
            'uniformSocialCredCode': uniformSocialCredCode,
            'startDate': startDate,
            'expireDate': expireDate,
            'note': note,
            'paperFileId': paperFileId,
            'fileDescribe': fileDescribe
            }
        req = Request(ServerUrl.ent_archive_create_url,data=data,headers=cookie)
        return req.post()

    @classmethod
    def ent_save_paper(cls,paperFileId,fileDescribe,archiveId,cookie):
        data = {
            'paperFileId':paperFileId,
            'fileDescribe':fileDescribe,
            'archiveId':archiveId
        }
        req = Request(ServerUrl.ent_savepaper_url,data=data,headers=cookie)
        return req.post()

    @classmethod
    def ent_checkinfo(cls,enterpriseName,signCode,uniformSocialCredCode,
                      orgInstCode,assocbsnssData,note,queryFormat,resultType,
                      qryReason,queryControlWarningType,serialNumber,archiveId,cookie):
        data = {
            'enterpriseName':enterpriseName,
            'signCode':signCode,
            'uniformSocialCredCode':uniformSocialCredCode,
            'orgInstCode':orgInstCode,
            'assocbsnssData':assocbsnssData,
            'note':note,
            'queryFormat':queryFormat,
            'resultType':resultType,
            'qryReason':qryReason,
            'queryControlWarningType':queryControlWarningType,
            'serialNumber':serialNumber,
            'archiveId':archiveId
        }
        req = Request(ServerUrl.ent_checkInfo_url,data=data,headers=cookie)
        return req.post()

    @classmethod
    def ent_inquire(cls,enterpriseName,
                    signCode,
                    uniformSocialCredCode,
                    orgInstCode,
                    assocbsnssData,
                    note,
                    queryFormat,
                    resultType,
                    qryReason,
                    queryControlWarningType,
                    serialNumber,
                    archiveId,
                    rekUser,
                    rekPasword,
                    checkWay,
                    autharchiveId,cookie):
        data = {
            'enterpriseName':enterpriseName,
            'signCode':signCode,
            'uniformSocialCredCode':uniformSocialCredCode,
            'orgInstCode':orgInstCode,
            'assocbsnssData':assocbsnssData,
            'note':note,
            'queryFormat':queryFormat,
            'resultType':resultType,
            'qryReason':qryReason,
            'queryControlWarningType':queryControlWarningType,
            'serialNumber':serialNumber,
            'archiveId':archiveId,
            'rekUser':rekUser,
            'rekPasword':rekPasword,
            'checkWay':checkWay,
            'autharchiveId':autharchiveId
        }
        req = Request(ServerUrl.ent_inquire_url, data=data, headers=cookie)
        return req.post()

    @classmethod
    def ent_show_report(cls,enterpriseName,
                            signCode,
                            uniformSocialCredCode,
                            orgInstCode,
                            assocbsnssData,
                            note,
                            queryFormat,
                            resultType,
                            qryReason,
                            queryControlWarningType,
                            serialNumber,
                            archiveId,
                            autharchiveId,
                            checkId,
                            rekUser,
                            checkWay,cookie):
        '''人行查询报告接口'''
        data = {
            'enterpriseName': enterpriseName,
            'signCode': signCode,
            'uniformSocialCredCode': uniformSocialCredCode,
            'orgInstCode': orgInstCode,
            'assocbsnssData': assocbsnssData,
            'note': note,
            'queryFormat': queryFormat,
            'resultType': resultType,
            'qryReason': qryReason,
            'queryControlWarningType': queryControlWarningType,
            'serialNumber': serialNumber,
            'archiveId': archiveId,
            'rekUser': rekUser,
            'checkId': checkId,
            'checkWay': checkWay,
            'autharchiveId': autharchiveId
        }
        req = Request(ServerUrl.ent_show_report_url, data=data, headers=cookie)
        return req.post()

    @classmethod
    def ent_reveal_report(cls,recordId,cookie):
        '''展示报告'''
        data = {
            'recordId':recordId
        }
        req = Request(ServerUrl.ent_reveal_report_url,params=data,headers=cookie)
        return req.get_download()


    @classmethod
    def local_report(cls,enterpriseName,
                            signCode,
                            uniformSocialCredCode,
                            orgInstCode,
                            assocbsnssData,
                            note,
                            queryFormat,
                            resultType,
                            qryReason,
                            queryControlWarningType,
                            serialNumber,
                            archiveId,
                            autharchiveId,
                            checkId,
                            rekUser,
                            checkWay,cookie):
        data = {
            'enterpriseName': enterpriseName,
            'signCode': signCode,
            'uniformSocialCredCode': uniformSocialCredCode,
            'orgInstCode': orgInstCode,
            'assocbsnssData': assocbsnssData,
            'note': note,
            'queryFormat': queryFormat,
            'resultType': resultType,
            'qryReason': qryReason,
            'queryControlWarningType': queryControlWarningType,
            'serialNumber': serialNumber,
            'archiveId': archiveId,
            'rekUser': rekUser,
            'checkId': checkId,
            'checkWay': checkWay,
            'autharchiveId': autharchiveId
        }
        req = Request(ServerUrl.ent_local_report_url,data=data,headers=cookie)
        return req.post()

    @classmethod
    def prevalidate(cls,pre,cookie):
        params = {
            'pre':pre
        }
        req = Request(ServerUrl.ent_prevalidate_url,params=params,headers=cookie)
        return req.post()

    @classmethod
    def save(cls, creditId, recordId, cookie):
        '''保存信用报告'''
        data = {
            'creditId': creditId,
            'recordId': recordId
        }
        req = Request(ServerUrl.ent_savereport_url, data=data, headers=cookie)
        return req.post_download()

    @classmethod
    def queryreportstatus(cls, creditId, recordId, cookie):
        '''获取状态'''
        params = {
            'creditId': creditId,
            'recordId': recordId
        }
        req = Request(ServerUrl.ent_queryreportstatus_url, params=params, headers=cookie)
        return req.get_list()

    @classmethod
    def saverrintLog(cls, recordId, cookie):
        params = {
            'recordId': recordId
        }
        req = Request(ServerUrl.ent_saverrintLog_url, params=params, headers=cookie)
        return req.post()

    @classmethod
    def printreport(cls, creditId, recordId, cookie):
        '''打印报告跳转'''
        params = {
            'creditId': creditId,
            'recordId': recordId
        }
        req = Request(ServerUrl.ent_printreport_url, params=params, headers=cookie)
        return req.get()

    @classmethod
    def savepdfandresurl(cls, creditId, recordId, cookie):
        '''pdf的url'''
        data = {
            'creditId': creditId,
            'recordId': recordId
        }
        req = Request(ServerUrl.ent_savepdfandresurl_url, data=data, headers=cookie)
        return req.post()




























if __name__ == "__main__":
    pass